var t = getApp();

Page({
    data: {
        emptyImage: "https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/image.png",
        group_id: "",
        showGroup: !1,
        showGroupMember: [],
        groupList: [],
        isLoadMore: !0,
        page: 1,
        total_page: 0
    },
    onLoad: function(t) {
        this.setData({
            group_id: t.group_id
        }), this.getDetails();
    },
    onReady: function() {},
    onShow: function() {},
    openMore: function(t) {
        var a = t.target.dataset.item || t.currentTarget.dataset.item;
        this.setData({
            showGroupMember: a.has_many_team_member,
            showGroup: !0
        });
    },
    closeMore: function() {
        this.setData({
            showGroup: !1
        });
    },
    getDetails: function() {
        var a = this, o = t.getNetAddresss("plugin.fight-groups-lottery.frontend.fight-groups-lottery.get-team-list");
        t._postNetWork({
            url: o,
            data: {
                group_id: this.data.group_id,
                page: 1
            },
            success: function(t) {
                var o = t.data;
                console.log(o), 1 == o.result ? a.setData({
                    groupList: o.data.data,
                    total_page: o.data.last_page
                }) : wx.showToast({
                    title: o.msg,
                    duration: 1e3,
                    icon: "none"
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    _getMoreDetails: function() {
        var a = this, o = t.getNetAddresss("plugin.fight-groups-lottery.frontend.fight-groups-lottery.get-team-list");
        this.data.page >= this.data.total_page ? this.setData({
            isLoadMore: !1
        }) : (this.setData({
            page: this.data.page + 1
        }), t._postNetWork({
            url: o,
            data: {
                group_id: this.data.group_id,
                page: this.data.page
            },
            success: function(t) {
                var o = t.data;
                1 == o.result ? a.setData({
                    isLoadMore: !0,
                    groupList: a.data.groupList.concat(o.data.data)
                }) : a.setData({
                    page: a.data.page - 1,
                    isLoadMore: !1
                });
            },
            fail: function(t) {
                console.log(t);
            }
        }));
    },
    onReachBottom: function() {
        this.data.isLoadMore ? this._getMoreDetails() : console.log("没有更多数据");
    },
    onShareAppMessage: function() {}
});